﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.Linq.Mapping;
using System.Data.Linq;
using System.Runtime.Serialization;

namespace MobiMenu.Restaurant
{
    [Table(Name = "OrderedDishes")]
    [DataContract(Namespace = "MobiMenu.Restaurant")]
    public class OrderedDish
    {
        private EntityRef<Dish> _dish;
        private EntityRef<Order> _order;
        public OrderedDish() 
        {
            this._dish = new EntityRef<Dish>();
            this._order = new EntityRef<Order>(); 
        }

        [Association(Storage = "_dish", ThisKey = "DishId")]
        public Dish Dish
        {
            get
            {
                return _dish.Entity;
            }
            set
            {
                _dish.Entity = value;
            }
        }

        private int _dishId;
        [Column(Storage = "_dishId")]
        [DataMember(Name = "dishId")]
        public int DishId
        {
            get
            {
                return _dishId;
            }
            set
            {
                _dishId = value;
            }
        }

        [Association(Storage = "_order", ThisKey = "OrderId")]
        public Order Order
        {
            get
            {
                return _order.Entity;
            }
            set
            {
                _order.Entity = value;
            }
        }

        private int _orderId;
        [Column(Storage = "_orderId")]
        [DataMember(Name = "orderId")]
        public int OrderId
        {
            get
            {
                return _orderId;
            }
            set
            {
                _orderId = value;
            }
        }

        private OrderedDishStatus _status;
        [Column(Storage = "_status")]
        [DataMember(Name = "status")]
        public OrderedDishStatus Status
        {
            get
            {
                return _status;
            }
            set
            {
                _status = value;
            }
        }

        private int _id;
        [Column(IsPrimaryKey = true, Storage = "_id", IsDbGenerated = true)]
        [DataMember(Name = "id")]
        public int Id
        {
            get
            {
                return _id;
            }
            set
            {
                _id = value;
            }
        }

        private DateTime _orderedTime;
        [Column(Storage = "_orderedTime")]
        [DataMember(Name = "orderedTime")]
        public DateTime OrderedTime
        {
            get
            {
                return _orderedTime;
            }
            set
            {
                _orderedTime = value;
            }
        }
    }
}
